package cn.iocoder.yudao.module.handguard.enums;

import cn.hutool.core.util.ArrayUtil;
import cn.iocoder.yudao.framework.common.core.IntArrayValuable;
import cn.iocoder.yudao.framework.common.enums.UserTypeEnum;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;

/**
 * 通用状态枚举
 *
 * @author 芋道源码
 */
@Getter
@AllArgsConstructor
public enum OrderStatusEnum implements IntArrayValuable {

    ONE(0, "失败"),
    TWO(1, "待跟进"),
    THREE(2, "跟进中"),
    FOUR(3, "完成");

    public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(OrderStatusEnum::getStatus).toArray();

    /**
     * 状态名
     */
    private final Integer status;

    /**
     * 状态值
     */
    private final String statusName;


    @Override
    public int[] array() {
        return ARRAYS;
    }



    public static OrderStatusEnum valueOf(Integer value) {
        return ArrayUtil.firstMatch(status -> status.getStatus().equals(value), OrderStatusEnum.values());
    }

}
